string_is_digits
This function returns a boolean value showing whether the passed string contains purely digits.
bool string_is_digits(string the_string)
Parameters:
the_string
The string that will be evaluated.
Return value:
Returns true if the string contains purely digits, false if not or if an error occurred.
Remarks:
This function does not evaluate numbers, but rather digits. If the string contains a negative or floating point number this function will return false.
Example:
void main()
{
string text1, text2;
text1="0.5";
text2="15244";
if(string_is_digits(text1))
{
alert("string_is_digits test", "text1 contains digits only.");
}
else
{
alert("string_is_digits test", "text1 does not contain only digits.");
}
if(string_is_digits(text2))
{
alert("string_is_digits test", "text2 contains digits only.");
}
else
{
alert("string_is_digits test", "text2 does not contain only digits.");
}
}